var article = {
    oTable: $('#table'),
    searchOk: $("#ok"),
    resetSearch: $("#reset"),
    init: function () {
        var _self = this;
        this.initConfigTable();
    },
    initConfigTable: function () {
        var _self = this;
        this.oTable.bootstrapTable({
            url: "/article/ajaxlist.html",
            method: 'post',
            contentType: "application/x-www-form-urlencoded",
            toolbar: '#toolbar',
            queryParams: this.queryParams,
            pagination: true, //是否分页
            pageSize: 20, //单页记录数
            pageList: [5, 10, 20, 50], //分页步进值
            sidePagination: "server",
            uniqueId: "id",
            columns: [
                {
                    title: "序号",
                    field: "mid",
                    checkbox: true
                },
                {
                    title: "标题",
                    field: "title"
                },
                {
                    title: "所属类别",
                    field: "typeid"
                },
                {
                    title: "更新时间",
                    field: "updated_at"
                },
                {
                    title: "管理操作",
                    field: "action",
                    class: "table-action-class"
                }
            ]
        });
        this.searchOk.bind("click", function () {
            _self.oTable.bootstrapTable("refresh", {pagination: true});
        });
        this.resetSearch.bind("click", function () {
            $('#toolbar').find('input[name]').each(function () {
                $(this).val("");
            });
            $('#toolbar').find('select[name]').each(function () {
                $(this).val("");
                $('.selectpicker').selectpicker('val', '-1');
            });
            _self.oTable.bootstrapTable("refresh", {pagination: true});
        });
    },
    queryParams: function (params) {
        $('#toolbar').find('input[name]').each(function () {
            params[$(this).attr('name')] = $(this).val();
        });
        $('#toolbar').find('select[name]').each(function () {
            params[$(this).attr('name')] = $(this).val();
        });
        return params;
    }
};
var slidelist = {
    oTable: $('#table'),
    searchOk: $("#ok"),
    resetSearch: $("#reset"),
    init: function () {
        var _self = this;
        this.initConfigTable();
    },
    initConfigTable: function () {
        var _self = this;
        this.oTable.bootstrapTable({
            url: "/article/ajaxslidelist.html",
            method: 'post',
            contentType: "application/x-www-form-urlencoded",
            toolbar: '#toolbar',
            queryParams: this.queryParams,
            pagination: true, //是否分页
            pageSize: 20, //单页记录数
            pageList: [5, 10, 20, 50], //分页步进值
            sidePagination: "server",
            uniqueId: "id",
            columns: [
                {
                    title: "标题",
                    field: "title"
                },
                {
                    title: "轮播图",
                    field: "image"
                },
                {
                    title: "链接地址",
                    field: "url"
                },
                {
                    title: "管理操作",
                    field: "action",
                    class: "table-action-class"
                }
            ]
        });
        this.searchOk.bind("click", function () {
            _self.oTable.bootstrapTable("refresh", {pagination: true});
        });
        this.resetSearch.bind("click", function () {
            $('#toolbar').find('input[name]').each(function () {
                $(this).val("");
            });
            $('#toolbar').find('select[name]').each(function () {
                $(this).val("");
                $('.selectpicker').selectpicker('val', '-1');
            });
            _self.oTable.bootstrapTable("refresh", {pagination: true});
        });
    },
    queryParams: function (params) {
        $('#toolbar').find('input[name]').each(function () {
            params[$(this).attr('name')] = $(this).val();
        });
        $('#toolbar').find('select[name]').each(function () {
            params[$(this).attr('name')] = $(this).val();
        });
        return params;
    }
};